package com.itheima_05;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class Test01 {
    public static void main(String[] args) throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
        ClassLoader classLoader = Test01.class.getClassLoader();
        InputStream resourceAsStream = classLoader.getResourceAsStream("prop.properties");
        Properties prop = new Properties();
        prop.load(resourceAsStream);

        String className = prop.getProperty("className");
        String methodName = prop.getProperty("methodName");

        //做反射

        Class clazz = Class.forName(className);
        Object o = clazz.newInstance();
        Method method = clazz.getMethod(methodName);
        method.invoke(o);
    }
}
